#ifndef __MEMPOOL 
#define __MEMPOOL

#include <stdint.h>

#ifndef NULL
#define NULL ((void *)0) 
#endif /*NULL*/


struct block_head
{
	struct block_head *next;
};


/**
 * @brief defination of mempool manager
 */
typedef struct
{
	/*zhe pool buffo size*/
	uint32_t capacity;
	/*zhe pool buffo address*/
	uint8_t *addr;
	
	/*memory unit size*/
	uint32_t blockSize;
	/*the header pointer of available link list*/
	struct block_head *header;
	/*the count of available link list*/
	uint32_t blockCount;
}mempool;



/*public function*/
void mempool_init(mempool *pool,uint32_t blockSize,uint32_t blockCount);
void *mempool_alloc(mempool *pool);
void mempool_free(mempool *pool,void *ptr);
void mempool_detach(mempool *pool);


#endif /*__MEMPOOL*/



